;; Tests of the Non-robust linear algebra functions
;; Copyright (C) 2022  Rocks Mazama
;;
;; This program is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;;
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with this program.  If not, see <https://www.gnu.org/licenses/>.

(ns mazama.linalg.transform.reflect-test
  (:require
   [clojure.test :refer [deftest is testing]]
   [mazama.linalg.transform.reflect :refer [transform]]))

(defn check-reflect [l a b]
  (let [f (transform l)]
    (is (= a (f b)))
    (is (= b (f a)))))

(deftest reflect
  (testing "Reflect about the y axis"
    (check-reflect [0 3] [1 -2] [-1 -2]))
  (testing "Reflect about the x axis"
    (check-reflect [-7 0] [-2 3] [-2 -3]))
  (testing "Reflect about y = x"
    (check-reflect [-3 -3] [-4 -5] [-5 -4]))
  (testing "Reflect about y = -x"
    (check-reflect [1 -1] [6 3] [-3 -6])))
